<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/favicon.ico">
  <link rel="icon" type="image/png" sizes="32x32" href="/favicon.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/favicon.ico">
  <link rel="mask-icon" href="/favicon.ico" color="#222">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="https://fonts.loli.net/css?family=Lato:300,300italic,400,400italic,700,700italic%7CZCOOL+QingKe+HuangYou:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" integrity="sha256-Vzbj7sDDS/woiFS3uNKo8eIuni59rjyNGtXfstRzStA=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/blue/pace-theme-bounce.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"www.kaaaaai.cn","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.12.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":"valine","storage":true,"lazyload":true,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="从上图可以看出使用自动化出包，可以优化掉好几个需要人工介入的步骤，优化开发流程，节省开发者的时间。">
<meta property="og:type" content="article">
<meta property="og:title" content="iOS 自动化打包上传 AppleStore、fir.im，并发邮件通知测试人员">
<meta property="og:url" content="https://www.kaaaaai.cn/ios-automated-packaging-complicated-by-mail.html">
<meta property="og:site_name" content="壹拾肆">
<meta property="og:description" content="从上图可以看出使用自动化出包，可以优化掉好几个需要人工介入的步骤，优化开发流程，节省开发者的时间。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2020/10/19/XKmLbdSTGNoWYZl.png">
<meta property="article:published_time" content="2020-10-19T03:24:52.000Z">
<meta property="article:modified_time" content="2022-04-25T09:10:56.299Z">
<meta property="article:author" content="Kaaaaai">
<meta property="article:tag" content="EXP">
<meta property="article:tag" content="iOS">
<meta property="article:tag" content="Xcode">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2020/10/19/XKmLbdSTGNoWYZl.png">


<link rel="canonical" href="https://www.kaaaaai.cn/ios-automated-packaging-complicated-by-mail.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://www.kaaaaai.cn/ios-automated-packaging-complicated-by-mail.html","path":"/ios-automated-packaging-complicated-by-mail.html","title":"iOS 自动化打包上传 AppleStore、fir.im，并发邮件通知测试人员"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>iOS 自动化打包上传 AppleStore、fir.im，并发邮件通知测试人员 | 壹拾肆</title>
  
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-102185873-1"></script>
  <script class="next-config" data-name="google_analytics" type="application/json">{"tracking_id":"UA-102185873-1","only_pageview":false}</script>
  <script src="/js/third-party/analytics/google-analytics.js"></script>

  <script src="/js/third-party/analytics/baidu-analytics.js"></script>
  <script async src="https://hm.baidu.com/hm.js?9578d14210d67becef48447e4f6b3f20"></script>



<link rel="dns-prefetch" href="https://waline-server-kaaaaai.vercel.app"> <script type="text/javascript" src="/js/link-highlight.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<link rel="alternate" href="/atom.xml" title="壹拾肆" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">壹拾肆</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">有些安排是多余的 这片空旷对我有益</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-moments"><a href="/bb/" rel="section"><i class="fa fa-coffee fa-fw"></i>碎片</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E5%8F%82%E8%80%83"><span class="nav-number">1.</span> <span class="nav-text">一、参考</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E8%84%9A%E6%9C%AC%E6%BA%90%E7%A0%81"><span class="nav-number">2.</span> <span class="nav-text">二、脚本源码</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%87%AA%E5%8A%A8%E6%89%93%E5%8C%85%E5%B9%B6%E4%B8%8A%E4%BC%A0"><span class="nav-number">2.1.</span> <span class="nav-text">自动打包并上传</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%B8%8A%E4%BC%A0%E6%88%90%E5%8A%9F%E6%88%90%E5%8A%9F%E5%90%8E%E5%8F%91%E9%80%81%E9%82%AE%E4%BB%B6"><span class="nav-number">2.2.</span> <span class="nav-text">上传成功成功后发送邮件</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81%E9%97%AE%E9%A2%98"><span class="nav-number">3.</span> <span class="nav-text">三、问题</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%B8%8A%E4%BC%A0%E5%B7%A5%E5%85%B7%E8%B7%AF%E5%BE%84%E4%B8%8D%E5%AF%B9%E9%97%AE%E9%A2%98"><span class="nav-number">3.1.</span> <span class="nav-text">上传工具路径不对问题</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#MARKETING-VERSION-%E8%8E%B7%E5%8F%96%E7%89%88%E6%9C%AC%E5%8F%B7%E5%A4%B1%E8%B4%A5"><span class="nav-number">3.2.</span> <span class="nav-text">$(MARKETING_VERSION) 获取版本号失败</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#xcrun-altool-%E2%80%93upload-app-f-path-u-username-p-password-%E4%B8%8A%E4%BC%A0%E5%A4%B1%E8%B4%A5"><span class="nav-number">3.3.</span> <span class="nav-text">xcrun altool –upload-app -f path -u username -p password 上传失败</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Kaaaaai"
      src="https://s2.loli.net/2022/03/29/GSJKrCRi4owa9hq.png">
  <p class="site-author-name" itemprop="name">Kaaaaai</p>
  <div class="site-description" itemprop="description">🐨🐨</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">100</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">66</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="sidebar-button site-overview-item animated">
    <button><i class="fa fa-comment"></i>
      Chat
    </button>
  </div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/Kaaaaai" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;Kaaaaai" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://stackoverflow.com/users/8342030/kaaaaai" title="StackOverflow → https:&#x2F;&#x2F;stackoverflow.com&#x2F;users&#x2F;8342030&#x2F;kaaaaai" rel="noopener" target="_blank"><i class="fab fa-stack-overflow fa-fw"></i>StackOverflow</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://www.instagram.com/edisonlllllk" title="Instagram → https:&#x2F;&#x2F;www.instagram.com&#x2F;edisonlllllk" rel="noopener" target="_blank"><i class="fab fa-instagram fa-fw"></i>Instagram</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:root@kaaaaai.cn" title="E-Mail → mailto:root@kaaaaai.cn" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



        </div>
      </div>

      
    <!-- 网易云歌曲 -->
    <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=421203025&auto=1&height=66"></iframe>
        <div class="back-to-top animated" role="button" aria-label="返回顶部">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://www.kaaaaai.cn/ios-automated-packaging-complicated-by-mail.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://s2.loli.net/2022/03/29/GSJKrCRi4owa9hq.png">
      <meta itemprop="name" content="Kaaaaai">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="壹拾肆">
      <meta itemprop="description" content="🐨🐨">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="iOS 自动化打包上传 AppleStore、fir.im，并发邮件通知测试人员 | 壹拾肆">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          iOS 自动化打包上传 AppleStore、fir.im，并发邮件通知测试人员
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2020-10-19 11:24:52" itemprop="dateCreated datePublished" datetime="2020-10-19T11:24:52+08:00">2020-10-19</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E7%AC%94%E8%AE%B0/" itemprop="url" rel="index"><span itemprop="name">笔记</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span id="busuanzi_value_page_pv"></span>
    </span>
  
  <span class="post-meta-item">
    
    <span class="post-meta-item-icon">
      <i class="far fa-comment"></i>
    </span>
    <span class="post-meta-item-text">Waline：</span>
  
    <a title="waline" href="/ios-automated-packaging-complicated-by-mail.html#waline" itemprop="discussionUrl">
      <span class="post-comments-count waline-comment-count" data-path="/ios-automated-packaging-complicated-by-mail.html" itemprop="commentCount"></span>
    </a>
  </span>
  
  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>9.1k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>8 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <p><img data-src="/images/loading-style-3.gif" data-original="https://i.loli.net/2020/10/19/XKmLbdSTGNoWYZl.png" alt="workflow"></p>
<p>从上图可以看出使用自动化出包，可以优化掉好几个需要人工介入的步骤，优化开发流程，节省开发者的时间。</p>
<p>自动打包的原理概不累述了，测试过程中如果有问题，可以用终端 <code>cd</code> 到项目目录，单独执行出问题的语句，再把错误的输出丢到搜索引擎，只要相信你遇到的问题别人肯定也会遇到，就一定能得到解决。如果有例外，那我相信——能弄出史无前例的问题的你，一定也厉害到可以史无前例的予以解决~当然也可以试着给我留言，说不定三个臭皮匠果真赛过诸葛亮。</p>
<p>脚本内容基本是基于网络上内容，做了整合，修复了一些可能会导致打包失败的错误。将打印添加颜色输出，以及添加了一些注释。</p>
<h1 id="一、参考"><a href="#一、参考" class="headerlink" title="一、参考"></a>一、参考</h1><ul>
<li><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/05dc9f925467">iOS 自动打包发布到 Fir 和 AppStore</a></li>
<li><a target="_blank" rel="noopener" href="https://blog.csdn.net/ismilesky/article/details/76689448">自动打包 ipa 文件，上传 fir.im 托管平台_ismilesky 的博客 - CSDN 博客</a></li>
</ul>
<p>延伸知识：<a target="_blank" rel="noopener" href="https://juejin.im/post/6844904067106340878">多渠道自动打包</a></p>
<h1 id="二、脚本源码"><a href="#二、脚本源码" class="headerlink" title="二、脚本源码"></a>二、脚本源码</h1><p>已做脱敏处理。</p>
<h2 id="自动打包并上传"><a href="#自动打包并上传" class="headerlink" title="自动打包并上传"></a>自动打包并上传</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#打包前需要在 xcode 工程中证书选项设置 `Automatically manage signing` 否则会报错</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#-------------项目自定义部分(自定义好下列参数后再执行该脚本)</span></span><br><span class="line"><span class="comment"># 计时</span></span><br><span class="line">SECONDS=0</span><br><span class="line"></span><br><span class="line"><span class="comment">#工程名 将XXX替换成自己的工程名</span></span><br><span class="line">project_name=xxxxx</span><br><span class="line"></span><br><span class="line"><span class="comment">#scheme名 将XXX替换成自己的sheme名</span></span><br><span class="line">scheme_name=xxxxx</span><br><span class="line"></span><br><span class="line"><span class="comment"># 工程中Target对应的配置plist文件名称, Xcode默认的配置文件为Info.plist</span></span><br><span class="line">info_plist_name=<span class="string">&quot;Info&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#打包模式 Debug/Release</span></span><br><span class="line">development_mode=Release</span><br><span class="line"></span><br><span class="line"><span class="comment">#firToken 替换成自己账号的 token</span></span><br><span class="line">fir_token=<span class="string">&quot;xxxxx&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#上传到 AppleStore 替换成自己的开发者账号</span></span><br><span class="line"><span class="comment">#密码需要到 https://appleid.apple.com/account 生成 App 专用密码</span></span><br><span class="line">apple_account=<span class="string">&quot;xxxxx&quot;</span></span><br><span class="line">apple_password=<span class="string">&quot;xxxxx&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># ----------------自动打包部分(无特殊情况不用修改)#</span></span><br><span class="line"><span class="comment">#工程绝对路径</span></span><br><span class="line">project_path=$(<span class="built_in">cd</span> `<span class="built_in">dirname</span> <span class="variable">$0</span>`; <span class="built_in">pwd</span>)</span><br><span class="line"></span><br><span class="line">archive_path=<span class="variable">$&#123;project_path&#125;</span>/PackageArchived</span><br><span class="line"></span><br><span class="line"><span class="comment">#build文件夹路径</span></span><br><span class="line">build_path=<span class="variable">$&#123;project_path&#125;</span>/AutoBuild</span><br><span class="line"></span><br><span class="line"><span class="comment">#plist文件所在路径</span></span><br><span class="line">exportOptionsPlistPath=<span class="variable">$&#123;project_path&#125;</span>/exportTest.plist</span><br><span class="line"></span><br><span class="line"><span class="comment"># 时间</span></span><br><span class="line">DATE=`<span class="built_in">date</span> <span class="string">&#x27;+%Y-%m-%d-%H-%m-%S&#x27;</span>`</span><br><span class="line"></span><br><span class="line"><span class="comment">#导出.ipa文件所在路径</span></span><br><span class="line">exportIpaPath=<span class="variable">$&#123;archive_path&#125;</span>/<span class="variable">$&#123;development_mode-$DATE&#125;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 获取版本号</span></span><br><span class="line">version=$(sed -n <span class="string">&#x27;/MARKETING_VERSION/&#123;s/MARKETING_VERSION = //;s/;//;s/^[[:space:]]*//;p;q;&#125;&#x27;</span> <span class="variable">$&#123;project_name&#125;</span>.xcodeproj/project.pbxproj)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 指定输出ipa名称</span></span><br><span class="line">ipa_name=<span class="string">&quot;<span class="variable">$scheme_name</span>-v<span class="variable">$version</span>&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#输出包路径，如果不存在创建，否则删除</span></span><br><span class="line"><span class="keyword">if</span> [ ! -d <span class="string">&quot;<span class="variable">$archive_path</span>&quot;</span> ];</span><br><span class="line"><span class="keyword">then</span></span><br><span class="line">	<span class="built_in">mkdir</span> -p <span class="string">&quot;<span class="variable">$archive_path</span>&quot;</span>;</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">	<span class="built_in">rm</span> -rf <span class="string">&quot;<span class="variable">$archive_path</span>&quot;</span></span><br><span class="line">	<span class="built_in">mkdir</span> -p <span class="string">&quot;<span class="variable">$archive_path</span>&quot;</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ -d <span class="string">&quot;<span class="variable">$build_path</span>&quot;</span> ]; <span class="keyword">then</span></span><br><span class="line">	<span class="comment">#statements</span></span><br><span class="line">	<span class="built_in">rm</span> -rf <span class="string">&quot;<span class="variable">$build_path</span>&quot;</span></span><br><span class="line">	<span class="built_in">mkdir</span> -p <span class="string">&quot;<span class="variable">$build_path</span>&quot;</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[34;1m请选择打包方式(输入序号,按回车即可) \033[0m&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[32;1m1:app-store       \033[0m&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[32;1m2:ad-hoc    \033[0m&quot;</span></span><br><span class="line"><span class="comment">##</span></span><br><span class="line"><span class="built_in">read</span> number</span><br><span class="line"><span class="keyword">while</span>([[ <span class="variable">$number</span> != 1 ]] &amp;&amp; [[ <span class="variable">$number</span> != 2 ]])</span><br><span class="line"><span class="keyword">do</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[31m错误! 请输入 1 或者 2\033[0m&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[34;1m请选择打包方式(输入序号,按回车即可) \033[0m&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[32;1m1:app-store       \033[0m&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[32;1m2:ad-hoc    \033[0m&quot;</span></span><br><span class="line"><span class="built_in">read</span> number</span><br><span class="line"><span class="keyword">done</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ <span class="variable">$number</span> == 1 ];<span class="keyword">then</span></span><br><span class="line">development_mode=Release</span><br><span class="line">exportOptionsPlistPath=<span class="variable">$&#123;project_path&#125;</span>/exportAppstore.plist</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">development_mode=Debug</span><br><span class="line">exportOptionsPlistPath=<span class="variable">$&#123;project_path&#125;</span>/exportTest.plist</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33;1m///-----------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33;1m/// 正在清理工程\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33;1m///-----------\033[0m&#x27;</span></span><br><span class="line"></span><br><span class="line">xcodebuild \</span><br><span class="line">clean -configuration <span class="variable">$&#123;development_mode&#125;</span> -quiet  || <span class="built_in">exit</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[32;1m///--------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[32;1m/// 清理完成\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[32;1m///--------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33;1m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[33;1m/// 正在编译工程: <span class="variable">$&#123;development_mode&#125;</span>\033[0m&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33;1m///-------------\033[0m&#x27;</span></span><br><span class="line">xcodebuild \</span><br><span class="line">archive -workspace <span class="variable">$&#123;project_path&#125;</span>/<span class="variable">$&#123;project_name&#125;</span>.xcworkspace \</span><br><span class="line">-scheme <span class="variable">$&#123;scheme_name&#125;</span> \</span><br><span class="line">-configuration <span class="variable">$&#123;development_mode&#125;</span> \</span><br><span class="line">-archivePath <span class="variable">$&#123;build_path&#125;</span>/<span class="variable">$&#123;project_name&#125;</span>.xcarchive  -quiet  || <span class="built_in">exit</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[32;1m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[32;1m/// 编译完成   \033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[32;1m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33m/// 开始ipa打包\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33m///-------------\033[0m&#x27;</span></span><br><span class="line">xcodebuild -exportArchive -archivePath <span class="variable">$&#123;build_path&#125;</span>/<span class="variable">$&#123;project_name&#125;</span>.xcarchive \</span><br><span class="line">-configuration <span class="variable">$&#123;development_mode&#125;</span> \</span><br><span class="line">-exportPath <span class="variable">$&#123;exportIpaPath&#125;</span> \</span><br><span class="line">-exportOptionsPlist <span class="variable">$&#123;exportOptionsPlistPath&#125;</span> \</span><br><span class="line">-allowProvisioningUpdates \</span><br><span class="line">-quiet || <span class="built_in">exit</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 修改ipa文件名称</span></span><br><span class="line"><span class="built_in">mv</span> <span class="variable">$exportIpaPath</span>/<span class="variable">$scheme_name</span>.ipa <span class="variable">$exportIpaPath</span>/<span class="variable">$ipa_name</span>.ipa</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ -e <span class="variable">$exportIpaPath</span>/<span class="variable">$ipa_name</span>.ipa ]; <span class="keyword">then</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[32;1m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[32;1m导出 <span class="variable">$&#123;ipa_name&#125;</span>.ipa 包成功 🎉🎉🎉  \033[0m&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[32;1m///-------------\033[0m&#x27;</span></span><br><span class="line">open <span class="variable">$exportIpaPath</span></span><br><span class="line"><span class="comment">#移除构建文件夹</span></span><br><span class="line"><span class="built_in">rm</span> -rf <span class="string">&quot;<span class="variable">$build_path</span>&quot;</span></span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[31;1m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[31;1m导出 <span class="variable">$&#123;ipa_name&#125;</span>.ipa 包失败 💔💔💔 \033[0m&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[31;1m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">exit</span> 1</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[36;1m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;\033[36;1m/// 打包 ipa 完成。总耗时:<span class="variable">$&#123;SECONDS&#125;</span>s \033[0m&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[36;1m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33m/// 开始发布ipa包 \033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33m///-------------\033[0m&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ <span class="variable">$number</span> == 1 ];<span class="keyword">then</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#验证并上传到App Store</span></span><br><span class="line"><span class="comment"># 将 -u 后面填入账号，-p后面填入密码</span></span><br><span class="line">altoolPath=<span class="string">&quot;/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework/Versions/A/Support/altool&quot;</span></span><br><span class="line"><span class="string">&quot;<span class="variable">$altoolPath</span>&quot;</span> --validate-app -f <span class="variable">$&#123;exportIpaPath&#125;</span>/<span class="variable">$&#123;ipa_name&#125;</span>.ipa -u <span class="variable">$apple_account</span> -p <span class="variable">$apple_password</span> -t ios --output-format xml</span><br><span class="line"><span class="string">&quot;<span class="variable">$altoolPath</span>&quot;</span> --upload-app -f <span class="variable">$&#123;exportIpaPath&#125;</span>/<span class="variable">$&#123;ipa_name&#125;</span>.ipa -u  <span class="variable">$apple_account</span> -p <span class="variable">$apple_password</span> -t ios --output-format xml</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#上传到 Fir</span></span><br><span class="line">fir login -T <span class="variable">$fir_token</span></span><br><span class="line">fir publish <span class="variable">$exportIpaPath</span>/<span class="variable">$ipa_name</span>.ipa --skip-update-icon</span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33m///-------------\033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33m/// 开始发送邮件给测试人员 \033[0m&#x27;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;\033[33m///-------------\033[0m&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#如需变更发件人和收件人邮箱，请到工程目录底下 sendEmail.py 文件内修改</span></span><br><span class="line">python sendEmail.py <span class="string">&quot;测试版本 (iOS)xxxxx v(<span class="variable">$&#123;version&#125;</span>) 上传成功&quot;</span> <span class="string">&quot;赶紧下载体验吧：xxxxx&quot;</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">exit</span> 0</span><br></pre></td></tr></table></figure>

<h2 id="上传成功成功后发送邮件"><a href="#上传成功成功后发送邮件" class="headerlink" title="上传成功成功后发送邮件"></a>上传成功成功后发送邮件</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># -*- coding: utf-8 -*</span></span><br><span class="line"><span class="comment">#!/usr/bin/env python3</span></span><br><span class="line"><span class="comment"># coding=utf-8</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># sendEmail title content</span></span><br><span class="line"><span class="keyword">import</span> sys</span><br><span class="line"><span class="keyword">import</span> smtplib</span><br><span class="line"><span class="keyword">import</span> io</span><br><span class="line"><span class="keyword">from</span> email.mime.text <span class="keyword">import</span> MIMEText</span><br><span class="line"><span class="keyword">from</span> email.header <span class="keyword">import</span> Header</span><br><span class="line"><span class="keyword">from</span> email.mime.image <span class="keyword">import</span> MIMEImage</span><br><span class="line"><span class="keyword">from</span> email.mime.multipart <span class="keyword">import</span> MIMEMultipart</span><br><span class="line"></span><br><span class="line">sender = <span class="string">&#x27;lvkai@cutecatos.com;&#x27;</span></span><br><span class="line"><span class="comment">#单个邮箱 改为 to_receiver = &#x27;xxxxx&#x27;</span></span><br><span class="line"><span class="comment">#群发邮箱</span></span><br><span class="line">to_receiver = [<span class="string">&#x27;xxxxx&#x27;</span>,<span class="string">&#x27;xxxxx&#x27;</span>]</span><br><span class="line"><span class="comment">#抄送</span></span><br><span class="line">cc_receiver = [<span class="string">&#x27;xxxxx&#x27;</span>]</span><br><span class="line">smtpserver = <span class="string">&#x27;smtp.exmail.qq.com&#x27;</span></span><br><span class="line"><span class="comment">#smtpserver = &#x27;smtp.exmail.qq.com&#x27;</span></span><br><span class="line">smtpport = <span class="number">465</span></span><br><span class="line"></span><br><span class="line">//smtp 配置，需要到邮箱账户设置界面自行获取</span><br><span class="line">username = <span class="string">&#x27;xxxxx&#x27;</span></span><br><span class="line">password = <span class="string">&#x27;xxxxx&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 待优化内容，发送网页形式 邮件</span></span><br><span class="line"><span class="comment"># SendHtml = &quot;&quot;&quot;</span></span><br><span class="line"><span class="comment"># &lt;html&gt;</span></span><br><span class="line"><span class="comment"># &lt;h1&gt;赶紧下载体验吧:&lt;a href=&quot;http://d.firim.vip/jpy7&quot;&gt;点击跳转&lt;/a&gt;&lt;/h1&gt;</span></span><br><span class="line"><span class="comment">#     &lt;/html&gt;</span></span><br><span class="line"><span class="comment"># &quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">send_mail</span>(<span class="params">title, content</span>):</span><br><span class="line">    </span><br><span class="line">    <span class="keyword">try</span>:</span><br><span class="line">        subject = title</span><br><span class="line"></span><br><span class="line">        msg = MIMEMultipart(<span class="string">&quot;related&quot;</span>)</span><br><span class="line"></span><br><span class="line">        <span class="comment"># msg = MIMEText(content,&#x27;plain&#x27;,&#x27;utf-8&#x27;)</span></span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span> <span class="keyword">not</span> <span class="built_in">isinstance</span>(title,unicode):</span><br><span class="line">            title = unicode(title, <span class="string">&#x27;utf-8&#x27;</span>)</span><br><span class="line">        msg[<span class="string">&#x27;Subject&#x27;</span>] = title</span><br><span class="line">        msg[<span class="string">&#x27;From&#x27;</span>] = sender</span><br><span class="line">        msg[<span class="string">&#x27;To&#x27;</span>] = <span class="string">&quot;;&quot;</span>.join(to_receiver)</span><br><span class="line">        msg[<span class="string">&#x27;Cc&#x27;</span>] = <span class="string">&quot;;&quot;</span>.join(cc_receiver)</span><br><span class="line">        msg[<span class="string">&quot;Accept-Language&quot;</span>]=<span class="string">&quot;zh-CN&quot;</span></span><br><span class="line">        msg[<span class="string">&quot;Accept-Charset&quot;</span>]=<span class="string">&quot;ISO-8859-1,utf-8&quot;</span></span><br><span class="line"></span><br><span class="line">        <span class="comment"># msgText = MIMEText(SendHtml,&quot;html&quot;,&quot;utf-8&quot;)</span></span><br><span class="line">        msgText = MIMEText(content,<span class="string">&#x27;plain&#x27;</span>,<span class="string">&#x27;utf-8&#x27;</span>)</span><br><span class="line">        msg.attach(msgText)</span><br><span class="line"></span><br><span class="line">        <span class="comment"># fp = open(&quot;Ta_Pro_adHoc.png&quot;, &#x27;rb&#x27;)</span></span><br><span class="line">        <span class="comment"># msgImage = MIMEImage(fp.read())</span></span><br><span class="line">        <span class="comment"># fp.close()</span></span><br><span class="line"></span><br><span class="line">        <span class="comment"># # 定义图片 ID，在 HTML 文本中引用</span></span><br><span class="line">        <span class="comment"># msgImage.add_header(&#x27;Content-ID&#x27;, &#x27;&lt;image&gt;&#x27;)</span></span><br><span class="line">        <span class="comment"># msg.attach(msgImage)</span></span><br><span class="line"></span><br><span class="line">        to_addrs=to_receiver+cc_receiver</span><br><span class="line">        smtp = smtplib.SMTP_SSL(smtpserver,smtpport)</span><br><span class="line">        smtp.login(username, password)</span><br><span class="line">        smtp.sendmail(sender, to_addrs, msg.as_string())</span><br><span class="line">        smtp.quit()</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">True</span></span><br><span class="line">    <span class="keyword">except</span> Exception, e:</span><br><span class="line">        <span class="built_in">print</span> <span class="built_in">str</span>(e)</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">False</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> send_mail(sys.argv[<span class="number">1</span>], sys.argv[<span class="number">2</span>]):</span><br><span class="line">    <span class="built_in">print</span> <span class="string">&quot;🎉🎉🎉发送成功!&quot;</span></span><br><span class="line"><span class="keyword">else</span>:</span><br><span class="line">    <span class="built_in">print</span> <span class="string">&quot;❌❌❌发送失败!&quot;</span></span><br></pre></td></tr></table></figure>

<h1 id="三、问题"><a href="#三、问题" class="headerlink" title="三、问题"></a>三、问题</h1><h2 id="上传工具路径不对问题"><a href="#上传工具路径不对问题" class="headerlink" title="上传工具路径不对问题"></a>上传工具路径不对问题</h2><p>解决方法来源：<a target="_blank" rel="noopener" href="https://www.cnblogs.com/guichongsui/p/11678841.html">xcode11 构建上传问题</a></p>
<p>从原来的</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool</span><br></pre></td></tr></table></figure>

<p>变为了</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework/Versions/A/Support/altool</span><br></pre></td></tr></table></figure>

<h2 id="MARKETING-VERSION-获取版本号失败"><a href="#MARKETING-VERSION-获取版本号失败" class="headerlink" title="$(MARKETING_VERSION) 获取版本号失败"></a>$(MARKETING_VERSION) 获取版本号失败</h2><p>解决方法来源：<a target="_blank" rel="noopener" href="https://medium.com/flawless-app-stories/how-to-handle-marketing-version-of-xcode-11-by-ci-db64a0ac71b9">How to handle $(MARKETING_VERSION) of Xcode 11 by CI</a></p>
<p>使用一下语句获取</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># get release number from Xcode build settings</span></span><br><span class="line">version=$(sed -n <span class="string">&#x27;/MARKETING_VERSION/&#123;s/MARKETING_VERSION = //;s/;//;s/^[[:space:]]*//;p;q;&#125;&#x27;</span> &#123;your project name&#125;.xcodeproj/project.pbxproj)</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ -z <span class="string">&quot;<span class="variable">$&#123;version&#125;</span>&quot;</span> ]; <span class="keyword">then</span></span><br><span class="line">  <span class="built_in">echo</span> <span class="string">&quot;[ERROR] failed to get MARKETING_VERSION&quot;</span></span><br><span class="line">  <span class="built_in">exit</span> 1</span><br><span class="line"><span class="keyword">fi</span></span><br></pre></td></tr></table></figure>

<h2 id="xcrun-altool-–upload-app-f-path-u-username-p-password-上传失败"><a href="#xcrun-altool-–upload-app-f-path-u-username-p-password-上传失败" class="headerlink" title="xcrun altool –upload-app -f path -u username -p password 上传失败"></a>xcrun altool –upload-app -f path -u username -p password 上传失败</h2><p>错误信息：</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">Error: Errors uploading <span class="string">&#x27;xxx.ipa&#x27;</span>: (</span><br><span class="line">    <span class="string">&quot;Error Domain=ITunesSoftwareServiceErrorDomain Code=-22014 \&quot;We are unable to create an authentication session.\&quot; </span></span><br><span class="line"><span class="string">UserInfo=&#123;NSLocalizedDescription=We are unable to create an authentication session., NSLocalizedFailureReason=Unable to </span></span><br><span class="line"><span class="string">validate your application.&#125;&quot;</span></span><br><span class="line">)</span><br></pre></td></tr></table></figure>

<p>解决方式：到 <a target="_blank" rel="noopener" href="https://appleid.apple.com/">https://appleid.apple.com</a> 生成一个专用密码就行了，然后用这个密码改到上面去，再次执行。即：<code>xcrun altool --upload-app -f a/b/xxx.ipa -u [xxxx@qq.com](mailto:xxxx@qq.com) -p 生成的专用密码</code></p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="reward-container">
  <div></div>
  <button>
    请喝咖啡
  </button>
  <div class="post-reward">
      <div>
        <img src="/images/loading-style-3.gif" data-original="https://s2.loli.net/2022/07/02/Gce8a5QAqrZ3X9R.gif" alt="Kaaaaai 微信">
        <span>微信</span>
      </div>

  </div>
</div>

          

<div class="post-copyright">
<ul>
  <li class="post-copyright-author">
      <strong>本文作者： </strong>Kaaaaai
  </li>
  <li class="post-copyright-link">
      <strong>本文链接：</strong>
      <a href="https://www.kaaaaai.cn/ios-automated-packaging-complicated-by-mail.html" title="iOS 自动化打包上传 AppleStore、fir.im，并发邮件通知测试人员">https://www.kaaaaai.cn/ios-automated-packaging-complicated-by-mail.html</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>

          <div class="post-tags">
              <a href="/tags/EXP/" rel="tag"><i class="fa fa-tag"></i> EXP</a>
              <a href="/tags/iOS/" rel="tag"><i class="fa fa-tag"></i> iOS</a>
              <a href="/tags/Xcode/" rel="tag"><i class="fa fa-tag"></i> Xcode</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/amateur-clipsself-improvement.html" rel="prev" title="业余剪辑自我修养">
                  <i class="fa fa-chevron-left"></i> 业余剪辑自我修养
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/recommend-a-few-podcasts.html" rel="next" title="推荐几个播客节目">
                  推荐几个播客节目 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments" id="waline"></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Kaaaaai</span>
</div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
    <span title="站点总字数">234k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">3:33</span>
  </span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>
  <!-- time -->
  <div id="show-time">
    <span id="span_dt_dt"></span>
  </div>
  <script>
      function show_date_time() {
        window.setTimeout("show_date_time()", 1000);
        BirthDay = new Date("6/23/2017 19:37:01");
        today = new Date();
        //总时间
        timeold = (today.getTime() - BirthDay.getTime());
        sectimeold = timeold / 1000
        secondsold = Math.floor(sectimeold);
        msPerDay = 24 * 60 * 60 * 1000
        e_daysold = timeold / msPerDay
        daysold = Math.floor(e_daysold);
        e_hrsold = (e_daysold - daysold) * 24;
        hrsold = Math.floor(e_hrsold);
        e_minsold = (e_hrsold - hrsold) * 60;
        minsold = Math.floor((e_hrsold - hrsold) * 60);
        seconds = Math.floor((e_minsold - minsold) * 60);
        span_dt_dt.innerHTML = "已存活 " + daysold + " 天 " + hrsold + " 小时 " + minsold + " 分 " + seconds + " 秒";
    }
    show_date_time();
  </script>

    </div>
  </footer>

  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.5.0/pjax.min.js" integrity="sha256-3NkoLDrmHLTYj7csHIZSr0MHAFTXth7Ua/DDt4MRUAg=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js" integrity="sha256-yt2kYMy0w8AbtF89WXb2P1rfjcP/HTHLT7097U8Y5b8=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  
<script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.0/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>
<script class="next-config" data-name="chatra" type="application/json">{"enable":true,"async":true,"id":"QXLRxXcsfrRJR2KTG"}</script>
<script src="/js/third-party/chat/chatra.js"></script>
<script async src="https://call.chatra.io/chatra.js"></script>



  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>

  
  <script data-pjax async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




<script class="next-config" data-name="waline" type="application/json">{"lang":"zh-cn","enable":true,"serverURL":"https://waline-server-kaaaaai.vercel.app","cssUrl":"https://unpkg.com/@waline/client@v2/dist/waline.css","commentCount":true,"pageview":false,"placeholder":"请文明评论呀","avatar":"mm","meta":["nick","mail","link"],"pageSize":10,"visitor":false,"comment_count":true,"requiredFields":[],"libUrl":"//unpkg.com/@waline/client@v2/dist/waline.js","el":"#waline","comment":true,"path":"/ios-automated-packaging-complicated-by-mail.html"}</script>
<link rel="stylesheet" href="https://unpkg.com/@waline/client@v2/dist/waline.css">
<script>
document.addEventListener('page:loaded', () => {
  NexT.utils.loadComments(CONFIG.waline.el).then(() =>
    NexT.utils.getScript(CONFIG.waline.libUrl, { condition: window.Waline })
  ).then(() => 
    Waline.init(Object.assign({}, CONFIG.waline,{ el: document.querySelector(CONFIG.waline.el) }))
  );
});
</script>


        <style>
            [bg-lazy] {
                background-image: none !important;
                background-color: #eee !important;
            }
        </style>
        <script>
            window.imageLazyLoadSetting = {
                isSPA: true,
                preloadRatio: 1,
                processImages: null,
            };
        </script><script>window.addEventListener("load",function(){var t=/\.(gif|jpg|jpeg|tiff|png)$/i,r=/^data:image\/[a-z]+;base64,/;Array.prototype.slice.call(document.querySelectorAll("img[data-original]")).forEach(function(a){var e=a.parentNode;"A"===e.tagName&&(e.href.match(t)||e.href.match(r))&&(e.href=a.dataset.original)})});</script><script>!function(r){r.imageLazyLoadSetting.processImages=t;var a=r.imageLazyLoadSetting.isSPA,n=r.imageLazyLoadSetting.preloadRatio||1,d=o();function o(){var t=Array.prototype.slice.call(document.querySelectorAll("img[data-original]")),e=Array.prototype.slice.call(document.querySelectorAll("[bg-lazy]"));return t.concat(e)}function t(t){(a||t)&&(d=o());for(var e,i=0;i<d.length;i++)0<=(e=(e=d[i]).getBoundingClientRect()).bottom&&0<=e.left&&e.top<=(r.innerHeight*n||document.documentElement.clientHeight*n)&&function(){var t,e,a,n,o=d[i];e=function(){d=d.filter(function(t){return o!==t}),r.imageLazyLoadSetting.onImageLoaded&&r.imageLazyLoadSetting.onImageLoaded(o)},(t=o).dataset.loaded||(t.hasAttribute("bg-lazy")?(t.removeAttribute("bg-lazy"),e&&e()):(a=new Image,n=t.getAttribute("data-original"),a.onload=function(){t.src=n,t.removeAttribute("data-original"),t.setAttribute("data-loaded",!0),e&&e()},a.onerror=function(){t.removeAttribute("data-original"),t.setAttribute("data-loaded",!1),t.src=n},t.src!==n&&(a.src=n)))}()}function e(){clearTimeout(t.tId),t.tId=setTimeout(t,500)}t(),document.addEventListener("scroll",e),r.addEventListener("resize",e),r.addEventListener("orientationchange",e)}(this);</script></body>
</html>
